home *** CD-ROM | disk | FTP | other *** search
- Path: kate.ibmpcug.co.uk!rcp!alan
- From: alan@rcp.co.uk (Alan Stokes)
- Newsgroups: comp.std.c
- Subject: Re: int's and zero
- Message-ID: <BR-8wAWLBh107h@rcp.co.uk>
- Date: Wed, 10 Jan 96 12:15:45 GMT
- References: <4cth4e$4q@odin.funcom.no> <4ctkfa$1fj0@info4.rus.uni-stuttgart.de>
- Organization: RCP Consultants Ltd.
-
- In <4ctkfa$1fj0@info4.rus.uni-stuttgart.de> schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt) writes:
- >In article <4cth4e$4q@odin.funcom.no>,
-
- >there is an (elegant, IMHO) way to initialize structures
- >as if you had written <member> = 0 for any member.
-
- Yes, there is, but it's not the way you suggest. How about:
-
- void
- foo (void)
- {
- struct intstruct { ... } bar = { 0 };
- /* Much more readable than memset(&bar, 0, sizeof bar); */
- }
-
- --
- Alan Stokes (alan@rcp.co.uk)
- RCP Consultants Ltd
- Didcot, UK
-